# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit git-r3 meson udev gnome2-utils

DESCRIPTION="Utility to flash disk images to multiple drives at once."
HOMEPAGE="https://gitlab.gnome.org/GNOME/gnome-multi-writer"
MY_AUTHOR="GNOME"

EGIT_REPO_URI="https://gitlab.gnome.org/${MY_AUTHOR}/${PN}.git"
MY_PV="GNOME_MULTI_WRITER_$(ver_rs 0-4 _)"

if [[ ${PV} == "9999" ]] ; then
	EGIT_BRANCH="master"
	KEYWORDS=""
else
	EGIT_COMMIT="${MY_PV}"
	KEYWORDS="~x86 ~amd64"
fi

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86"
IUSE=""

RDEPEND="dev-libs/glib:2
         >=x11-libs/gtk+-3.11.2:3
         >=dev-libs/libgusb-0.2.7
         virtual/libgudev
         >=media-libs/libcanberra-0.10[gtk3]
         >=sys-auth/polkit-0.1
         sys-fs/udisks:2
         dev-libs/glib:2
         gnome-base/gsettings-desktop-schemas
         "

DEPEND="${RDEPEND}"

BDEPEND="virtual/pkgconfig"

#src_prepare() {
#        gnome2_src_prepare
#}

src_install() {
        meson_src_install
}

pkg_postinst() {
        xdg_desktop_database_update 
        xdg_mimeinfo_database_update
        gnome2_icon_cache_update
        gnome2_schemas_update

}

pkg_postrm() {
        xdg_desktop_database_update 
        xdg_mimeinfo_database_update
        gnome2_icon_cache_update
        gnome2_schemas_update
}

#src_configure() {
#                local emesonargs=(
#                        -Ddoc=$(usex doc true false)
#                        -Dx11-examples=$(usex examples true false)
#                        -Ddrivers=all
#                        -Dudev_rules=true
#                        -Dudev_rules_dir=$(get_udevdir)/rules.d
#                        --libdir=/usr/$(get_libdir)
#                )
#                meson_src_configure
#}
